﻿using MediatR;
using StoreIGet.Applications.Command;
using StoreIModels;
using StoreRepositorys.Interface;

namespace StoreIGet.Applications.CommandHandler
{
    public class RelationshipStoreCommandHandler : IRequestHandler<RelationshipStoreCommand, List<RelationshipStoreModels>>
    {
        public readonly IRelationshipStoreRepository _storeRepository;
        public RelationshipStoreCommandHandler(IRelationshipStoreRepository storeRepository)
        {
            _storeRepository = storeRepository;
        }
        public async Task<List<RelationshipStoreModels>> Handle(RelationshipStoreCommand request, CancellationToken cancellationToken)
        {
            return await _storeRepository.GetAllAsync(x => x.StoreId == request.Id);
        }
    }
}
